﻿using Microsoft.Xna.Framework;

namespace Tribaan.Components
{
	public class SolidColorBackgroundComponent : DrawableGameComponent, ISolidColorBackground
	{
		#region Constructors

		public SolidColorBackgroundComponent(Game game)
			: base(game)
		{
			game.Services.AddService<ISolidColorBackground>(this);
		}

		#endregion

		#region Properties

		public Color Color { get; set; }

		#endregion

		#region Methods

		protected override void Dispose(bool disposing)
		{
			Game.Services.RemoveService<ISolidColorBackground>();
			base.Dispose(disposing);
		}

		public override void Draw(GameTime gameTime)
		{
			GraphicsDevice.Clear(Color);

			base.Draw(gameTime);
		}

		#endregion
	}
}